<template>
  <div style="width:100%;height:100%;background:none">
    <div class="title">进出场动态</div>
    <div style="margin-left:2rem;height:90%" v-if="!this.homeLoading">
      <vue-seamless-scroll
        v-if="List.length>5"
        :data="List"
        class="seamless-warp"
        :class-option="classOption"
      >
        <ul>
          <li v-for="(item, index) in List" :key="index">
            <span>{{item.recordTime}}</span>
            <!-- <span>{{item.tenderCode}}</span> -->
            <span>{{item.tenderCode}}</span>
            <span>{{item.fullName}}</span>
            <span>{{item.news}}</span>
          </li>
        </ul>
      </vue-seamless-scroll>
      <ul v-else>
        <li v-for="(item, index) in List" :key="index">
          <span style="width:20%">{{item.recordTime}}</span>
          <!-- <span>{{item.tenderCode}}</span> -->
          <span>{{item.tenderCode}}</span>
          <span>{{item.fullName}}</span>
          <span>{{item.news}}</span>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import vueSeamlessScroll from 'vue-seamless-scroll'
import { queryInoutNews } from '@/api/dataCenterHome'
import { mapGetters } from 'vuex'
export default {
  data() {
    return {
      List: []
    }
  },
  components: {
    //组件
    vueSeamlessScroll
  },
  computed: {
    ...mapGetters(['homeLoading', 'userInfo']),
    classOption() {
      return {
        step: 0.2, // 数值越大速度滚动越快
        limitMoveNum: 2, // 开始无缝滚动的数据量 this.dataList.length
        hoverStop: true, // 是否开启鼠标悬停stop
        direction: 1, // 0向下 1向上 2向左 3向右
        openWatch: true, // 开启数据实时监控刷新dom
        singleHeight: 0, // 单步运动停止的高度(默认值0是无缝不停止的滚动) direction => 0/1
        singleWidth: 0, // 单步运动停止的宽度(默认值0是无缝不停止的滚动) direction => 2/3
        waitTime: 1000 // 单步运动停止的时间(默认值1000ms)
        //  openRoll:false,
        // fheight:300,
      }
    }
  },
  mounted() {
    //  this.$store.commit('setLoading', false)

    this.queryInoutData()
  },
  methods: {
    //获取进出场数据
    queryInoutData() {
      queryInoutNews({ projectId: this.$store.state.userInfo.projectId }).then((res) => {
        res.data.data.forEach((item) => {
          item.recordTime = item.recordTime.replace('00:00:00', '')
        })

        this.List = res.data.data
      })
    }
  }
}
</script>

<style scoped>
.title {
  font-size: 1.6rem;
  color: #fff;
  margin-bottom: 5%;
}
ul {
  margin: 0;
  overflow: hidden;
  font-size: 1.4rem;
  font-family: 'Microsoft YaHei';
  font-weight: 400;
  color: #5cffff;
}
ul,
li {
  margin: 0;
  padding: 0;
  list-style: none;
}
li {
  cursor: pointer;
  margin-bottom: 1rem;
  padding: 0.3rem;
}
li:hover {
  color: #fff;
  background: #6d8346;
  transition: 0.5s all;
}
.seamless-warp {
  width: 100%;
  height: 80%;
  margin: 0;
  overflow: hidden;
  font-size: 1.4rem;
  font-family: 'Microsoft YaHei';
  font-weight: 400;
  color: #5cffff;
}
span {
  width: 25%;
  display: inline-block;
  /* margin-right: 1rem; */
}
</style>